﻿@{
    ViewBag.Title = "EntrustXX";
    Layout = "~/Views/Shared/Template.cshtml";
}
<script src="~/Scripts/jquery-1.8.2.min.js"></script>

<div class="bgcSil">
    <div class="container">
        <div class="mt30" style="width: 100%">
            <ul id="divLeft" style="width:24%" class="nav navbar-nav"></ul>
            <div id="divContent" style="width:75%;" class="fr mb80 cont bgcWhit news-list-con">
                <div class="news-list-con bgcWhit">
                    <div>
                        <h3 style="margin-left:35%;">推送房源</h3>
                        <table class="table table-striped table-bordered table-hover table-condensed">
                            <tr>
                                <td style="text-align:right;"><span class="c-red">房源类型：</span></td>
                                <td>
                                    <input name="O_Name" readonly value="@Model.Item1" type="text" class="form-control" maxlength='11' style="width:200px;">
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align:right;"><span>装修程度：</span></td>
                                <td><input name="O_Company" readonly value="@Model.Item2" type="text" class="form-control" maxlength='11' style="width:200px;"></td>
                            </tr>
                            <tr>
                                <td style="text-align:right;"><span>面积（平方米）：</span></td>
                                <td>
                                    <input id="Price" name="O_Price" readonly value="@Model.Item3" type="text" class="form-control" maxlength='11' style="width:200px;">
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align:right;"><span>地址：</span></td>
                                <td>
                                    <input id="Num" name="O_Num" readonly type="text" value="@Model.Item4" class="form-control" style="width:200px;">
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align:right;">租金（千元/月）：</td>
                                <td>
                                    <input id="Sum" value="@Model.Item5" readonly type="text" class="form-control" style="width:200px;">
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align:right;">期望售价</td>
                                <td>
                                    <input id="Sum" value="@Model.Item6" readonly type="text" class="form-control" style="width:200px;">
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align:right;">联系电话</td>
                                <td>
                                    <input id="Sum" value="@Model.Item7.Item1" readonly type="text" class="form-control" style="width:200px;">
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align:right;">客户留言</td>
                                <td>
                                    <input id="Sum" value="@Model.Item7.Item2" readonly type="text" class="form-control" style="width:200px;">
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align:right;">创建人</td>
                                <td>
                                    <input id="Sum" value="@Model.Item7.Item3" readonly type="text" class="form-control" style="width:200px;">
                                    <input type="hidden" id="txtUseId" value="@Model.Item7.Item5" />
                                    <input type="hidden" id="txtId" value="@Model.Item7.Item6" />
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align:right;">创建时间</td>
                                <td>
                                    <input id="Sum" value="@Model.Item7.Item4" readonly type="text" class="form-control" style="width:200px;">
                                </td>
                            </tr>
                        </table>

                    </div>
                    <div class="news-list-info clearfix">
                        <input type="button" onclick="SendHouse()" value="推送" />
                        <ul id='messageBox'>
                            @foreach (var a in ViewBag.houseList)
                            {
                                <li hoseid="adbedfc63077473997f9dfc9e23ea6e6" class="fcBlack pr">
                                    <a class="fl" href="/f/information?id=adbedfc63077473997f9dfc9e23ea6e6" target="_blank">
                                        <img src="http://47.93.33.136:8080/userfiles/1/images/adminReleaseRoom/img/2017/08/fangjian.jpg" alt="@a.House_Name - @a.House_Telphone" />
                                    </a>
                                    <input type="checkbox" class="chckb" name="PayName" value="@a.House_Id" style="width:20px; height:20px;" />
                                    <div class="news-note">
                                        <div class="fl">
                                            <h3>
                                                <a class="fcBlack" href="/f/information?id=adbedfc63077473997f9dfc9e23ea6e6" target="_blank" title="@a.House_Name - @a.House_Telphone">@a.House_Name - @a.House_Telphone</a>
                                            </h3>
                                            <p class="p"><span>面积</span>&nbsp;&nbsp;&nbsp;<span>@a.House_Area m<sup>2</sup> | @a.House_Decorate</span></p>
                                            <p>地址 ： @a.House_Address</p>
                                            <br />
                                        </div>
                                        <div class=" fr">
                                            <p>租<span style="color: red;font-size: 30px">@a.House_Price</span><img src="file:///C:\Users\lilili\AppData\Local\Temp\SGPicFaceTpBq\8376\0AE5B7E8.png" />千元/月</p>
                                            <p>售<span style="color: red;font-size: 30px"></span>元/月</p>
                                        </div>
                                    </div>
                                </li>
                            }
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    function SendHouse() {
        //批量推送
        obj = document.getElementsByName("PayName");
        var id = "";
        for (var i = 0; i < obj.length; i++) {
            if (obj[i].checked) {
                id += obj[i].value + ',';
            }
        }
        id = id.substring(0, id.length - 1);
       
        if (id.length == 0) {
            alert("请选择一个要推送的房源!");
        }
        else
            if (confirm('确定要推送所选房源吗？')) {
                $.ajax({
                    type: "post",
                    url: "/AdminCenter/SendHouse",
                    data: { House_Id: id, useid: $("#txtUseId").val(), txtId: $("#txtId").val() },
                    success: function (obj) {
                        if (obj > 0) {
                            location.href = '/AdminCenter/EntrustList';
                        }
                        else {
                            alert('推送失败');
                        }
                    }
                })
            }
    }
</script>

<script>
    ParentNav();
    // 绑定根节点
    function ParentNav() {
        $.ajax({
            type: "post",
            url: "/Partner/LeftNav",
            dataType: "json",
            success: function (data) {
                var htmltab = "";
                for (var i = 0; i < data.length; i++) {
                    htmltab += "<li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" style=\"width: 175px;font-size: 16px;\">" + data[i].Lar_Name + "</a>" + SonNav(data[i].Limit_Id) + "</li>";
                }
                $("#divLeft").append(htmltab);
            },
            error: function (err) {
                alert(err);
            }
        })
    }
    // 绑定子节点
    function SonNav(id) {
        var html1 = "";
        $.ajax({
            type: "post",
            url: "/Partner/LeftSon",
            data: { pid: id },
            dataType: "json",
            async: false,
            success: function (data) {
                var strhtml = "<ul class=\"dropdown-menu\">"
                for (var i = 0; i < data.length; i++) {
                    strhtml += "<li><a href=\"" + data[i].Limit_Url + "\">" + data[i].Limit_Name + "</a></li>"
                }
                strhtml += "</ul>";
                html1 = strhtml;
            }
        })
        return html1;
    }
</script>
